<template>
    <h2>充值</h2>
    <table border="1">
        <tr>
            <td>
                充值金额<input type="text" v-model="price" />
            </td>
        </tr>
        <tr>
            <td>会员支付方式</td>
            <td>
                <input type="radio" value="现金" v-model="method"/>现金
                <input type="radio" value="微信" v-model="method"/>微信
                <input type="radio" value="支付宝" v-model="method"/>支付宝
            </td>
        </tr>
        <tr>
            <td>
                备注<textarea rows="3" v-model="remark"></textarea>
            </td>
        </tr>
        <tr>
            <td>
                <input type="button" value="确定" @click="changeScore" />
            </td>
        </tr>
    </table>
</template>

<script setup lang="ts">
 import {ref,onMounted} from 'vue'
    import {useRouter} from 'vue-router'
    const router=useRouter();
    import axios from 'axios'
    import { useMemberStore } from '../../store';
    const useStore=useMemberStore();
    const price=ref("");
    const method=ref("");
    const remark=ref("");
    const changeScore=()=>{
        axios.get('https://localhost:7292/api/Member/InfoChangePrice',{
            params:{
                mid:useStore.mid,
                price:price.value,
                method:method.value,
                remark:remark.value
            }
        })
        .then(res=>{
            if(res.data>0)
            {
                alert('修改成功');
                router.push('/showInfo');
            }
            else
            {
                alert('修改失败');
            }
        })
    }
</script>